<template>
  <div class="elm-edit pfull" style="overflow: hidden;">
    <elm-page-bb>
      <el-descriptions :title="now_year" :column="4" size="medium" border>
        <el-descriptions-item label="订单收入(万元)">
          <el-tag type="success">{{info.dd_income_now_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="合同收入(万元)">
          <el-tag type="success">{{info.ht_income_now_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="项目收入(万元)">
          <el-tag type="success">{{info.pj_income_now_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="总收入(万元)">
          <el-tag type="success">{{info.total_income_now_year}}</el-tag>
        </el-descriptions-item>
        
        <el-descriptions-item label="项目成本(万元)">
          <el-tag type="danger">{{info.pj_cost_now_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="外委成本(万元)">
          <el-tag type="danger">{{info.ww_cost_now_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="人工成本(万元)">
          <el-tag type="danger">{{info.rg_cost_now_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="总成本(万元)">
          <el-tag type="danger">{{info.total_cost_now_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="净利润(万元)" :span="2">
          <el-tag type="success">{{info.net_profit_now_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="同比增长率" :span="2">
          <el-tag type="success">{{info.growth_rate}}%</el-tag>
        </el-descriptions-item>
      </el-descriptions>
      
      <el-descriptions :title="prev_year" :column="4" size="medium" border>
        <el-descriptions-item label="订单收入(万元)">
          <el-tag type="success">{{info.dd_income_prev_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="合同收入(万元)">
          <el-tag type="success">{{info.ht_income_prev_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="项目收入(万元)">
          <el-tag type="success">{{info.pj_income_prev_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="总收入(万元)">
          <el-tag type="success">{{info.total_income_prev_year}}</el-tag>
        </el-descriptions-item>
        
        <el-descriptions-item label="项目成本(万元)">
          <el-tag type="danger">{{info.pj_cost_prev_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="外委成本(万元)">
          <el-tag type="danger">{{info.ww_cost_prev_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="人工成本(万元)">
          <el-tag type="danger">{{info.rg_cost_prev_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="总成本(万元)">
          <el-tag type="danger">{{info.total_cost_prev_year}}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="净利润(万元)">
          <el-tag type="success">{{info.net_profit_prev_year}}</el-tag>
        </el-descriptions-item>
      </el-descriptions>
    </elm-page-bb>
  </div>
</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      info: elm.dialog.request.info,
      now_year: '',
      prev_year: '',
    }
  },
  created() {
  },
  mounted() {
    let month = this.info.month;
    let currentYear = new Date().getFullYear();
    let monthIndex = parseInt(month.replace('月', '')) - 1;
    let date_param = new Date(currentYear, monthIndex);
    let now_year = elm.parseTime(date_param, '{y}-{m}');
    this.now_year = now_year;
    
    let date_param_prev = new Date(currentYear-1, monthIndex);
    let prev_year = elm.parseTime(date_param_prev, '{y}-{m}');
    this.prev_year = prev_year;
  },
  methods: {
  }
}
</script>

<style scoped>
::v-deep .el-descriptions .el-descriptions__header {
  margin-top: 20px;
  margin-bottom: 5px;
}

::v-deep .el-descriptions-item__cell.el-descriptions-item__label.is-bordered-label {
  color: #606266;
}
</style>